1. Field of the Invention
The present invention relates to control and status registers for controlling and monitoring devices within computer systems. More specifically, the present invention relates to a method and an apparatus for performing read and write operations to control and status registers within a device.
2. Related Art
Processors typically control a device within a computer system through control and status registers (CSRs). In order to determine the state of a device, a processor reads from status registers within the device. In order to configure or control functions of the device, the processor writes to control registers within the device.
As devices have grown increasingly more complex, the number of control and status registers has also increased. Some devices now provide hundreds of control and status registers that can be manipulated by the processor.
In some devices control and status registers are memory-mapped into an address space of the processor so that the processor can directly read from and write to the registers. Unfortunately, other devices do not include such an interface that allows a processor to directly access the control and status registers.
In these devices, control and status registers can be accessed through a serial channel that shifts the desired data values onto and off of the semiconductor chip. Some application specific integrated circuits (ASICs) accomplish this by using a JTAG controller adhering to the IEEE 1149.1 standard. In this type of system, control and status registers are accessed by shifting the data values into a chain of "shadow registers" that temporarily hold copies of the data values for the control and status registers. During a write operation, a chain of data values is shifted into the chain of shadow registers before the shadow registers are copied into the control and status registers in an atomic operation. During a read operation, the control and status register are first copied into the chain of shadow registers in an atomic operation. Next, the shadow registers are shifted off of the chip to complete the read operation. The use of shadow registers allows the control and status registers to be read from and written to in a single atomic operation. This eliminates potential problems in shifting data values through the control and status registers.
Unfortunately, using shadow registers doubles the number of registers required for control and status purposes on the semiconductor chip. This can consume a significant amount of semiconductor real estate for large numbers of control and status registers, which increases the cost of the semiconductor chip. Furthermore, the process of shifting a long chain of shadow registers can be time-consuming, especially if only a single register in the chain needs to be accessed.
What is needed is a method and apparatus for accessing control and status registers for a device that does not require each control and status register to have a corresponding shadow register.